package com.example.emos.wx.filter;

import com.example.emos.wx.utils.XssHttpServletRequestWrapper;

import javax.servlet.*;
import javax.servlet.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

@WebFilter(filterName = "XssFilter",urlPatterns = "/*")
public class XssFilter implements Filter {
    public void init(FilterConfig config) throws ServletException {
        System.out.println(config);
    }

    public void destroy() {
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {
        XssHttpServletRequestWrapper req = new XssHttpServletRequestWrapper((HttpServletRequest) request);
        chain.doFilter(req, response);
    }
}
